package com.ice.delay.task.core.enums;

/**
 * @author ice
 * @Date 2022/5/29 0029 14:02
 */
public enum NotifyStatusEnum {
    // 通知状态（ 0:初始状态 1:成功 2:失败重试中 3:失败）
    INIT(0, "初始状态"),
    SUCCESS(1, "成功"),
    FAIL_RETRY(2, "失败重试中"),
    FAIL(3, "失败");


    private String name;
    private Integer code;

    NotifyStatusEnum(Integer code, String name) {
        this.name = name;
        this.code = code;
    }

    public static String getName(Integer code) {
        for (NotifyStatusEnum c : NotifyStatusEnum.values()) {
            if (c.getCode().equals(code)) {
                return c.name;
            }
        }
        return null;
    }

    public String getName() {
        return name;
    }

    public Integer getCode() {
        return code;
    }

}
